#pragma once

//-----------------------------------------------------
// Include Files
//-----------------------------------------------------
#include "StdAfx.h"
#include "d3dUtil.h"
#include "Transformer.h"
#include "RenderContext.h"
#include "ContentManager.h" 

class InputState;
class Character;

class Level;
//-----------------------------------------------------
// LevelElement Class									
//-----------------------------------------------------
class LevelElement
{
public:
	LevelElement();				// Constructor
	virtual ~LevelElement();	// Destructor

	//-------------------------------------------------
	// Eigen methoden								
	//-------------------------------------------------
	/*************************************************************************
	* Gets the parent object Pointer
	*/
	Level *GetParent()const{return m_pLevel;}
	/*************************************************************************
	* Sets the parent pointer
	*/
	void SetParent(Level *pLevel){ m_pLevel=pLevel; }
	void SetName(const tstring &sName){m_sNodeName = sName;}
	void ResetWorldMatrix();
	void SetWorldMatrix(const D3DXMATRIX& world);
	const D3DXMATRIX& GetWorldMatrix() const;

	virtual void Initialize(ContentManager *pContentManager)=0;
	virtual void Tick(const InputState & refInputState)=0;
	virtual void Draw(const RenderContext* pRenderContext) = 0;
	virtual void DrawRefraction(const RenderContext* pRenderContext, D3DXPLANE refractionplane) = 0;
	virtual void DrawReflection(const RenderContext* pRenderContext, D3DXMATRIX reflectionviewmatrix, D3DXPLANE reflectionplane) = 0;
	virtual void DrawShadowMap(const RenderContext* pRenderContext) = 0;
	virtual void OnResize(int ClientWidth, int ClientHeight){}
	
	//transform worldmatrix
	virtual void Translate(const D3DXVECTOR3 pos);
	virtual void Rotate(const D3DXVECTOR3 angles);
	virtual void Scale(const D3DXVECTOR3 scales);

	/**
	* Called when this object is triggered by a character.
	*/ 
	virtual void OnTriggerEnter(Character* player){};

	/**
	* Called when the character leaves the trigger area.
	*/
	virtual void OnTriggerExit(Character* player){};

	void SetShadowMap(ID3D10ShaderResourceView* shadowmap)
	{
		m_ShadowDepthMapTexture = shadowmap;
	}
protected: 
	//-------------------------------------------------
	// Datamembers								
	//-------------------------------------------------

	/*************************************************************************
	* Holds pointer to parent object
	* equals 0 if no parent is present
	*/
	Level *m_pLevel;

	/*************************************************************************
	* Holds World matrix of the element
	*/
	D3DXMATRIX m_World;	

	/*************************************************************************
	* String used to find nodes by name
	*/
	tstring m_sNodeName;

	/*************************************************************************
	* Used to transform this object
	*/
	Transformer m_Transformer;

	ID3D10ShaderResourceView* m_ShadowDepthMapTexture;
	ID3D10EffectScalarVariable* m_pFogModeVariable;
	ID3D10EffectScalarVariable* m_pFogStartVariable;
	ID3D10EffectScalarVariable* m_pFogEndVariable;
	ID3D10EffectScalarVariable* m_pFogDensityVariable;
	ID3D10EffectScalarVariable* m_pFogMaxHeightVariable;
	ID3D10EffectVectorVariable* m_pFogColorVariable;

private:
	// -------------------------
	// Disabling default copy constructor and default 
	// assignment operator.
	// -------------------------
	LevelElement(const LevelElement& yRef);									
	LevelElement& operator=(const LevelElement& yRef);	
};

 
